<script setup>
import { useRouter } from "vue-router";
const router = useRouter();
const routerChange = (n, obj) => {
  router.push({ path: n, query: obj });
};
</script>
<template>
  <h1>父组件</h1>
  <p>
    <button @click="routerChange('/one', { xd: '小滴课堂' })">打开组件1</button>
    <br />
    <button @click="routerChange('/two')">打开组件2</button> <br />
    <button @click="routerChange('/two/three')">打开组件3</button>
  </p>
  <div>
    <router-view></router-view>
  </div>
</template>
